package com.zoe.vhr.service.impl;

import com.zoe.vhr.mapper.DepartmentMapper;
import com.zoe.vhr.model.Department;
import com.zoe.vhr.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Zoe.Zhang
 * @Date: 2021/08/07
 * @Description
 */
@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    DepartmentMapper departmentMapper;

    @Override
    public List<Department> listAllDepartmentsWithChildren() {
        return departmentMapper.listAllDepartmentsWithChildren(-1);
    }

    @Override
    public void savaDepartment(Department department) {
        department.setEnabled(true);
        departmentMapper.savaDepartment(department);
    }

    @Override
    public List<Department> listAllDepartmentName() {
        return departmentMapper.listAllDepartmentName();
    }

    @Override
    public void deleteDepartment(Department department) {
        departmentMapper.deleteDepartment(department);
    }
}
